<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>css动画</title>
    <style type="text/css">
    body {
        width: 100%;
        height: 100%;
        padding-top: 150px;
    }
    .box {
        width:80px;
        height:80px;
        background:blue;
        -moz-transition:width 2s; /* Firefox 4 */
        -webkit-transition:width 2s; /* Safari and Chrome */
        -o-transition:width 2s; /* Opera */
        transition: all 3s linear;
    }
    .box:hover
    {
        width:300px;
        transform: rotate(30deg);
    }
    .box-anim {
        background-color: gold;
        width:200px;
        transform: scale(2) translateX(200px);
    }

    /* animation 动画*/
    .box2
    {
        width:100px;
        height:100px;
        background:lightgreen;
        border-radius: 50%;
        position:relative;
        animation: mymove 5s infinite;
        animation-timing-function: ease-in-out;
    }

    @keyframes mymove {
        0% { 
            left: 0px;
            top: 0px;
        }
        33% { 
            left: 100px; 
            top: 0px
        }
        66% {
            left: 50px; 
            top: 100px
        }
        100% {
            left: 0px;
            top: 0px;
        }
    }

    </style>
</head>
    <body>
        <div class="box"></div>
        <!-- <div class="box2"></div> -->
    </body>

    <script>
        // transition 动画
        // setTimeout(() => {
        //     const boxDom = document.querySelector('.box')
        //     boxDom.classList.add('box-anim')
        // }, 3000);
        // setTimeout(() => {
        //     document.querySelector('.box').classList.remove('box-anim')
        // }, 8000);

        // animation动画

    </script>
</html>